<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script>
            $(document).ready(function() {    
                
                $('body').on('click', '#addUser', function() {
                    $.post("data.jsp",{
                        user_name:$('#user_name').val()                         
                    },function(data){                                   
                        $("#result_text").html(data);                              
                    });
                }
            );
                
            });
        </script>
    </head>
    <body>
       
        <hr>
        <form id="form1">
            <strong>Ingresa tu nombre: <strong><br/>
            <input type="text" id="user_name" name="user_name"/>
            <input type="button" id="addUser" name="addUser" value="Enviar"/>
            <br/>
            <div id="result_text">
            </div>
        </form>
    </body>
</html>
